package com.tencreat.domain.mall;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.tencreat.common.annotation.Excel;
import com.tencreat.common.core.domain.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.time.LocalDateTime;
import java.util.List;


/**
 * 类目对象 mall_category
 *
 * @author tencreat
 * @date 2021-08-19
 */
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
@AllArgsConstructor
@NoArgsConstructor
@ApiModel
@TableName("mall_category")
public class MallCategory extends BaseEntity<MallCategory> {
    private static final long serialVersionUID = 1L;


    /**
     * $column.columnComment
     */
    @TableId(type = IdType.AUTO)
    @ApiModelProperty(value = "ID")
    private Long id;


    /**
     * 类目名称
     */
    @Excel(name = "类目名称")
    @ApiModelProperty(value = "类目名称")
    @TableField("`name`")
    private String name;


    /**
     * 类目关键字，以JSON数组格式
     */
    @Excel(name = "类目关键字，以JSON数组格式")
    @ApiModelProperty(value = "类目关键字，以JSON数组格式")
    @TableField("`keywords`")
    private String keywords;


    /**
     * 类目广告语介绍
     */
    @Excel(name = "类目广告语介绍")
    @ApiModelProperty(value = "类目广告语介绍")
    @TableField("`desc`")
    private String desc;


    /**
     * 父类目ID
     */
    @Excel(name = "父类目ID")
    @ApiModelProperty(value = "父类目ID")
    @TableField("`pid`")
    private Long pid;


    /**
     * 类目图标
     */
    @Excel(name = "类目图标")
    @ApiModelProperty(value = "类目图标")
    @TableField("`icon_url`")
    private String iconUrl;


    /**
     * 类目图片
     */
    @Excel(name = "商城类目图片")
    @ApiModelProperty(value = "商城类目图片")
    @TableField("`pic_url`")
    private String picUrl;


    /**
     * $column.columnComment
     */
    @Excel(name = "商城类目等级")
    @ApiModelProperty(value = "商城类目等级")
    @TableField("`level`")
    private String level;

    @JsonIgnore
    @ApiModelProperty(value = "是否有子分类")
    @TableField("`has_children`")
    private Boolean hasChildren;


    /**
     * 排序
     */
    @Excel(name = "排序")
    @ApiModelProperty(value = "排序")
    @TableField("`sort_order`")
    private Integer sortOrder;

    @Excel(name = "状态")
    @ApiModelProperty(value = "状态")
    @TableField("`status`")
    private Boolean status;


    /**
     * 删除标志（0代表存在 2代表删除）
     */
    @TableLogic
    @TableField("`del_flag`")
    private String delFlag;


    /**
     * 租户ID
     */
    @Excel(name = "租户ID")
    @ApiModelProperty(value = "租户ID")
    @TableField("`tenant_id`")
    private Long tenantId;

    /**
     * 排序修改时间
     */
    @Excel(name = "排序修改时间")
    @ApiModelProperty(value = "排序修改时间")
    @TableField("`sort_update_time`")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime sortUpdateTime;


    @TableField(exist = false)
    private List<MallCategory> child;

    @Excel(name = "分类类型（0 店铺 |1 商城 ）")
    @ApiModelProperty(value = "分类类型（0 店铺 |1 商城 ）")
    @TableField("`category_type`")
    private Long categoryType;

    /**
     * 店铺类型
     */
    @Excel(name = "店铺类型")
    @ApiModelProperty(value = "0 美食 1医疗")
    @TableField("`type`")
    private Long type;


    @Excel(name = "供应链父id")
    @ApiModelProperty(value = "供应链父id")
    @TableField("`chain_pid`")
    private String chainPid;

    @Excel(name = "供应链分类id")
    @ApiModelProperty(value = "供应链分类id")
    @TableField("`chain_id`")
    private String chainId;
}
